package com.wl4837;

public class App
{
    public static void main( String[] args )
    {
        // 构建语法树：3 + (5 - 2)
        Expression expr = new AddExpression(
                new NumberExpression(3),
                new SubtractExpression(
                        new NumberExpression(5),
                        new NumberExpression(2)
                )
        );

        // 执行解释
        Context context = new Context();
        int result = expr.interpret(context);
        System.out.println("Result: " + result); // 输出：Result: 6
    }
}
